JBoss Community Archive (Read Only)

ModeShape 3

REST Service 3.x

Represents the default version of the RESTful API distributed with ModeShape 3. It provides the following methods:

1. Retrieve a list of available repositories

URL: http://<host>:<port>/<context>

HTTP Method: GET

Produces: application/json; text/html; text/plain;

Default Output: text/html

Response Code (if successful): OK

Response Format:

{
    "repositories":[
        {
            "name":"repo",
            "workspaces":"http://localhost:8090/resources/repo",
            "metadata":{
                "custom.rep.name":"repo",
                "custom.rep.workspace.names":"default",}
                .....
            }
         }
     ]
}

2. Retrieve a list of workspaces for a repository

URL: http://<host>:<port>/<context>/<repository_name>

HTTP Method: GET

Produces: application/json; text/html; text/plain;

Default Output: text/html

Response Code (if successful): OK

Response Format:

{
    "workspaces":[
        {
            "name":"default",
            "repository":"http://localhost:8090/resources/repo",
            "items":"http://localhost:8090/resources/repo/default/items",
            "query":"http://localhost:8090/resources/repo/default/query",
            "binary":"http://localhost:8090/resources/repo/default/binary",
            "nodeTypes":"http://localhost:8090/resources/repo/default/nodetypes"
        }
    ]
}

3. Retrieve a node or a property

Retrieves an item at a given path.

URL: http://<host>:<port>/<context>/<repository_name>/<workspace_name>/items/<item_path>

HTTP Method: GET

Produces: application/json; text/html; text/plain;

Default Output: text/html

Response Code (if successful): OK

Optional Query Parameters:

  • depth - a numeric value indicating how many level of children should be retrieved under the node located at path. A  negative value indicates all children

Response Format:

{
    "self":"http://localhost:8090/resources/repo/default/items/someNode",
    "up":"http://localhost:8090/resources/repo/default/items/",
    "id":"319a0554-3504-4984-b54b-3a9367caac92",
    "jcr:primaryType":"{http://www.modeshape.org/1.0}root",
    "jcr:uuid":"319a0554-3504-4984-b54b-3a9367caac92",
    "children":{
        "jcr:system":{
            "self":"http://localhost:8090/resources/repo/default/items/jcr:system",
            "up":"http://localhost:8090/resources/repo/default/items/",
            "id": "0a851519-e87d-4e02-b399-0503aa70ab3f"
        }
    }
}

4. Create a node

Creates a node at the given path, using the body of request as JSON content

URL: http://<host>:<port>/<context>/<repository_name>/<workspace_name>/items/<node_path>

HTTP Method: POST

Produces: application/json; text/html; text/plain;

Default Output: application/json

Request Content-Type: application/json

Response Code (if successful): CREATED

Request Format:

{
    "jcr:primaryType":"nt:unstructured",
    "testProperty":"testValue",
    "multiValuedProperty":["value1", "value2"],
    "children":{
        "childNode":{
            "nestedProperty":"nestedValue"
        }
    }
}

Response Format:

{
    "self":"http://localhost:8090/resources/repo/default/items/testNode",
    "up":"http://localhost:8090/resources/repo/default/items/",
    "id":"bf171df0-daa2-481d-a48a-b3965cd69d9c",
    "jcr:primaryType":"{http://www.jcp.org/jcr/nt/1.0}unstructured",
    "multiValuedProperty":[
        "value1",
        "value2"
    ],
    "testProperty":"testValue",
    "children":{
        "childNode":{
            "self":"http://localhost:8090/resources/repo/default/items/testNode/childNode",
            "up":"http://localhost:8090/resources/repo/default/items/testNode",
            "id":"113e6eea-cbd2-4837-8344-5b28bbfd695c",
        }
    }
}
Multiple properties with the same name

The different JSON specs that are out there have conflicting views on whether multiple keys with the same name should be allowed or not. See this for more information.

ModeShape's REST service follows the ECMA JSON specification, which allows multiple keys with the same name, the effective behavior being that the last key always wins.

5. Update a node or a property

Updates a node or a property at the given path, using the body of request as JSON content

URL: http://<host>:<port>/<context>/<repository_name>/<workspace_name>/items/<item_path>

HTTP Method: PUT

Produces: application/json; text/html; text/plain;

Default Output: application/json

Request Content-Type: application/json

Response Code (if successful): OK

Request Format:

Node: same as the one used when creating

Property:

{"testProperty":"some_new_value"}

Response Format:

Node: same as one used when creating

Property:

{"testProperty":"some_new_value"}

6. Delete a node or a property

Deletes the node or the property at the given path. If a node is being deleted, this will also delete all of its descendants.

URL: http://<host>:<port>/<context>/<repository_name>/<workspace_name>/items/<item_path>

HTTP Method: DELETE

Produces: none

Response Code (if successful): NO_CONTENT

7. Retrieve a node by its identifier

Retrieves a node with a specified identifier. This is equivalent to the Session.getNodeByIdentifier(String) method, where the identifier is obtained from the "id" field (or the "jcr:uuid" field if the node is mix:referenceable) in a previous response. Remember that node identifiers are generated by the repository, are opaque (and are not always UUIDs), and always remains the same for a given node (even when moved or renamed) until the node is destroyed.

URL: http://<host>:<port>/<context>/<repository_name>/<workspace_name>/nodes/<node_id>

HTTP Method: GET

Produces: application/json; text/html; text/plain;

Default Output: text/html

Response Code (if successful): OK

Optional Query Parameters:

  • depth - a numeric value indicating how many level of children should be retrieved under the node located at path. A  negative value indicates all children

Response Format:

{
    "self":"http://localhost:8090/resources/repo/default/items/someNode",
    "up":"http://localhost:8090/resources/repo/default/items/",
    "id":"319a0554-3504-4984-b54b-3a9367caac92",
    "jcr:primaryType":"{http://www.modeshape.org/1.0}root",
    "jcr:uuid":"319a0554-3504-4984-b54b-3a9367caac92",
    "children":{
        "jcr:system":{
            "self":"http://localhost:8090/resources/repo/default/items/jcr:system",
            "up":"http://localhost:8090/resources/repo/default/items/",
            "id": "0a851519-e87d-4e02-b399-0503aa70ab3f"
        }
    }
}

8. Update a node by its identifier

Updates a node with the given identifier, using the body of request as JSON content. The identifier must be obtained from the "id" field in a previous response.

URL: http://<host>:<port>/<context>/<repository_name>/<workspace_name>/nodes/<node_id>

HTTP Method: PUT

Produces: application/json; text/html; text/plain;

Default Output: application/json

Request Content-Type: application/json

Response Code (if successful): OK

Request Format:

Node: same as the one used when creating a node

Property:

{"testProperty":"some_new_value"}

Response Format:

Node: same as one used when creating a node

Property:

{"testProperty":"some_new_value"}

9. Delete a node by its identifier

Deletes the node with the given identifier, and all of its descendants. The identifier must be obtained from the "id" field in a previous response.

URL: http://<host>:<port>/<context>/<repository_name>/<workspace_name>/nodes/<node_id>

HTTP Method: DELETE

Produces: none

Response Code (if successful): NO_CONTENT

10. Execute a JCR query

Executes a JCR query in either: XPath, SQL or SQL2 format, returning a JSON object in response.

URL: http://<host>:<port>/<context>/<repository_name>/<workspace_name>/query

HTTP Method: POST

Produces: application/json; text/html; text/plain;

Request Content-Type: application/jcr+sql; application/jcr+xpath; application/jcr+sql2; application/jcr+search

Default Output: application/json

Response Code (if successful): OK

Optional Query Parameters:

  • offset - the index in the result set where to start the retrieval of data

  • limit - the maximum number of rows to return

Response Format:

{
    "columns":{
        "jcr:path":"STRING",
        "jcr:score":"DOUBLE",
        "foo":"STRING"
    },
    "rows":[
        {
            "jcr:path":"/{}testNode/{}child[2]",
            "jcr:score":"0.8575897812843323",
            "foo":"value",
            "mode:uri":"http://localhost:8090/resources/repo/default/items/testNode/child[2]"
        },
        {
            "jcr:path":"/{}testNode/{}child[3]",
            "jcr:score":"0.8575897812843323",
            "foo":"value",
            "mode:uri":"http://localhost:8090/resources/repo/default/items/testNode/child[3]"
        }
    ]
}

11. Create multiple nodes

Creates multiple nodes (bulk operation) in the repository, using a single session. If any of the nodes cannot be created, the entire operation fails.

URL: _http://<host>:<port>/<context>/<repository_name>/<workspace_name>/items

HTTP Method: POST

Produces: application/json; text/html; text/plain;

Default Output: application/json

Request Content-Type: application/json

Response Code (if successful): OK

Request Format:

{
    "testNode/child/subChild" : {
        "jcr:primaryType":"nt:unstructured",
        "testProperty":"testValue",
        "multiValuedProperty":["value1", "value2"]
    },
    "testNode/child" : {
        "jcr:primaryType":"nt:unstructured",
        "testProperty":"testValue",
        "multiValuedProperty":["value1", "value2"]
    },
    "testNode/otherChild" : {
        "jcr:primaryType":"nt:unstructured",
        "testProperty":"testValue",
        "multiValuedProperty":["value1", "value2"],
        "children":{
            "otherSubChild":{
                "nestedProperty":"nestedValue"
            }
        }
    }
}

Response Format:

[
    {
        "self":"http://localhost:8090/resources/repo/default/items/testNode/child",
        "up":"http://localhost:8090/resources/repo/default/items/testNode",
        "id":"0ef2edc9-c873-4a2f-805e-2950b98225c6",
        "jcr:primaryType":"{http://www.jcp.org/jcr/nt/1.0}unstructured",
        "multiValuedProperty":[
            "value1",
            "value2"
        ],
        "testProperty":"testValue"
    },
    {
        "self":"http://localhost:8090/resources/repo/default/items/testNode/child/subChild",
        "up":"http://localhost:8090/resources/repo/default/items/testNode/child",
        "id":"fb6f4d82-33e1-4bc1-8048-d1f9a685779b",
        "jcr:primaryType":"{http://www.jcp.org/jcr/nt/1.0}unstructured",
        "multiValuedProperty":[
            "value1",
            "value2"
        ],
        "testProperty":"testValue"
    },
    {
        "self":"http://localhost:8090/resources/repo/default/items/testNode/otherChild",
        "up":"http://localhost:8090/resources/repo/default/items/testNode",
        "id":"da12f5f9-4ab9-48d7-a159-07144e378d54",
        "jcr:primaryType":"{http://www.jcp.org/jcr/nt/1.0}unstructured",
        "multiValuedProperty":[
            "value1",
            "value2"
        ],
        "testProperty":"testValue",
        "children":{
            "otherSubChild":{
                "self":"http://localhost:8090/resources/repo/default/items/testNode/otherChild/otherSubChild",
                "up":"http://localhost:8090/resources/repo/default/items/testNode/otherChild"
                "id":"21ea01f5-e41c-4aea-9087-e241e02a4b2d",
            }
        }
    }
]

12. Update multiple items

Updates multiple nodes and/or properties (bulk operation) in the repository, using a single session. If any of the items cannot be updated, the entire operation fails.

URL: _http://<host>:<port>/<context>/<repository_name>/<workspace_name>/items

HTTP Method: PUT

Produces: application/json; text/html; text/plain;

Default Output: application/json

Request Content-Type: application/json

Response Code (if successful): OK

Request Format: same as the one used when creating multiple nodes.

Response Format: same as the one used when creating multiple nodes.

13. Delete multiple items

Deletes multiple items (bulk operation) in the repository, using a single session. If any of the items cannot be removed, the entire operation fails.

URL: _http://<host>:<port>/<context>/<repository_name>/<workspace_name>/items

HTTP Method: DELETE

Produces: none;

Request Content-Type: application/json

Response Code (if successful): OK

Request Format:

["testNode/otherChild", "testNode/child",  "testNode/child/subChild"]

14. Retrieve a node type

Retrieves the information about a registered node type in the repository.

URL: http://<host>:<port>/<context>/<repository_name>/<workspace_name>/nodetypes/node_type_name

HTTP Method: GET

Produces: application/json; text/html; text/plain;

Default Output: text/html

Response Code (if successful): OK

Response Format:

{
    "nt:base":{
        "mixin":false,
        "abstract":true,
        "queryable":true,
        "hasOrderableChildNodes":false,
        "propertyDefinitions":[
            {
                "jcr:primaryType":{
                    "requiredType":"Name",
                    "declaringNodeTypeName":"nt:base",
                    "mandatory":true,
                    "multiple":false,
                    "autocreated":true,
                    "protected":true,
                    "fullTextSearchable":true,
                    "onParentVersion":"COMPUTE"
                }
            },
            {
                "jcr:mixinTypes":{
                    "requiredType":"Name",
                    "declaringNodeTypeName":"nt:base",
                    "mandatory":false,
                    "multiple":true,
                    "autocreated":false,
                    "protected":true,
                    "fullTextSearchable":true,
                    "onParentVersion":"COMPUTE"
                }
            }
        ],
        "subTypes":[
            "http://localhost:8090/resources/repo/default/nodetypes/mode:lock",
            "http://localhost:8090/resources/repo/default/nodetypes/mode:locks",
             ....
        ]
    }
}

15. Import a CND file (via request content)

Imports a CND file into the Repository, using the entire request body stream as the content of the CND. If you were using curl, this would be the equivalent of curl -d

URL: _http://<host>:<port>/<context>/<repository_name>/<workspace_name>/nodetypes

HTTP Method: POST

Produces: application/json; text/html; text/plain;

Default Output: application/json

Response Code (if successful): OK

Response Format:

[
    {
        "nt:base":{
            "mixin":false,
            "abstract":true,
            "queryable":true,
            "hasOrderableChildNodes":false,
            "propertyDefinitions":[
                {
                    "jcr:primaryType":{
                        "requiredType":"Name",
                        "declaringNodeTypeName":"nt:base",
                        "mandatory":true,
                        "multiple":false,
                        "autocreated":true,
                        "protected":true,
                        "fullTextSearchable":true,
                        "onParentVersion":"COMPUTE"
                    }
                },
                {
                    "jcr:mixinTypes":{
                        "requiredType":"Name",
                        "declaringNodeTypeName":"nt:base",
                        "mandatory":false,
                        "multiple":true,
                        "autocreated":false,
                        "protected":true,
                        "fullTextSearchable":true,
                        "onParentVersion":"COMPUTE"
                    }
                }
            ],
            "subTypes":[
                "http://localhost:8090/resources/repo/default/nodetypes/mode:lock",
                ...
            ]
        }
    },
    {
        "nt:unstructured":{
            "mixin":false,
            "abstract":false,
            "queryable":true,
            "hasOrderableChildNodes":true,
            "propertyDefinitions":[
                {
                    "*":{
                        "requiredType":"undefined",
                        "declaringNodeTypeName":"nt:unstructured",
                        "mandatory":false,
                        "multiple":true,
                        "autocreated":false,
                        "protected":false,
                        "fullTextSearchable":true,
                        "onParentVersion":"COPY"
                    }
                },
                {
                    "*":{
                        "requiredType":"undefined",
                        "declaringNodeTypeName":"nt:unstructured",
                        "mandatory":false,
                        "multiple":false,
                        "autocreated":false,
                        "protected":false,
                        "fullTextSearchable":true,
                        "onParentVersion":"COPY"
                    }
                }
            ],
            "superTypes":[
                "http://localhost:8090/resources/repo/default/nodetypes/nt:base"
            ]
        }
    },
    {
        "mix:created":{
            "mixin":true,
            "abstract":false,
            "queryable":true,
            "hasOrderableChildNodes":false,
            "propertyDefinitions":[
                {
                    "jcr:created":{
                        "requiredType":"Date",
                        "declaringNodeTypeName":"mix:created",
                        "mandatory":false,
                        "multiple":false,
                        "autocreated":false,
                        "protected":true,
                        "fullTextSearchable":true,
                        "onParentVersion":"COPY"
                    }
                },
                {
                    "jcr:createdBy":{
                        "requiredType":"String",
                        "declaringNodeTypeName":"mix:created",
                        "mandatory":false,
                        "multiple":false,
                        "autocreated":false,
                        "protected":true,
                        "fullTextSearchable":true,
                        "onParentVersion":"COPY"
                    }
                }
            ],
            "subTypes":[
                "http://localhost:8090/resources/repo/default/nodetypes/nt:hierarchyNode"
            ]
        }
    }
]

16. Import a CND file (via "multipart/form-data")

Imports a CND file into the Repository when the CND file came from a form submission, where the name of the HTML element is file. If you were using curl, this would be the equivalent of curl -F

URL: _http://<host>:<port>/<context>/<repository_name>/<workspace_name>/nodetypes

HTTP Method: POST

Produces: application/json; text/html; text/plain;

Request Content-Type: multipart/form-data

Default Output: application/json

Response Code (if successful): OK

Response Format: the same as when importing a CND via the request body.

17. Retrieve a binary property

Retrieves the content of a binary property from the repository, at a given path, by streaming it to the response.

URL: http://<host>:<port>/<context>/<repository_name>/<workspace_name>/binary/binary_property_path

HTTP Method: GET

Produces: the mime-type of the binary, or a default mime-type

Response Code (if successful): OK

Optional Query Parameters:

  • mimeType - a string which can be provided by the client, in case it already knows the expected mimetype of the binary stream. Otherwise, ModeShape will try to detect the mimetype using its own detectors mechanism

  • contentDisposition - a string which will be returned as the Content-Disposition response header. If none provide, the default is: attachment;filename=property_parent_name

18. Create a binary property (via request content)

Creates a new binary property in the repository, at the given path, using the entire request body stream as the content of the binary. If you were using curl, this would be the equivalent of curl -d

URL: http://<host>:<port>/<context>/<repository_name>/<workspace_name>/binary/binary_property_path

HTTP Method: POST

Produces: application/json; text/html; text/plain;

Default Output: application/json

Response Code (if successful): OK

Response Format:

{
    "testProperty":"http://localhost:8090/resources/repo/default/binary/testNode/testProperty",
    "self":"http://localhost:8090/resources/repo/default/items/testNode/testProperty",
    "up":"http://localhost:8090/resources/repo/default/items/testNode"
}

19. Update a binary property (via request content)

Updates the content of a binary property in the repository, at the given path, using the entire request body stream as the content of the binary. If you were using curl, this would be the equivalent of curl -d

URL: http://<host>:<port>/<context>/<repository_name>/<workspace_name>/binary/binary_property_path

HTTP Method: POST, PUT

Produces: application/json; text/html; text/plain;

Default Output: application/json

Response Code (if successful): OK

Response Format: the same as in the case when creating a new binary property

20. Create/Update a binary property (via "multipart/form-data")

Creates or updates the content of a binary property in the repository, at the given path, when the content came from a form submission, where the name of the HTML element is file.
If you were using curl, this would be the equivalent of curl -F

URL: http://<host>:<port>/<context>/<repository_name>/<workspace_name>/binary/binary_property_path

HTTP Method: POST

Produces: application/json; text/html; text/plain;

Default Output: application/json

Request Content-Type: multipart/form-data

Response Code (if successful): OK

Response Format: the same as in the case when creating a new binary property

21. Obtain a query plan for a JCR query

Obtain the query plan for an XPath, SQL or SQL2 query, returning the string representation of the query plan.

URL: http://<host>:<port>/<context>/<repository_name>/<workspace_name>/queryPlan

HTTP Method: POST

Produces: application/json; text/html; text/plain;

Default Output: text/plain

Request Content-Type: application/jcr+sql; application/jcr+xpath; application/jcr+sql2; application/jcr+search

Response Code (if successful): OK

Optional Query Parameters:

  • offset - the index in the result set where to start the retrieval of data

  • limit - the maximum number of rows to return

Response Format (as "application/json"):

{
    "statement":"SELECT * FROM [nt:unstructured] WHERE ISCHILDNODE('\/testNode')",
    "language":"JCR-SQL2",
    "abstractQueryModel":"SELECT * FROM [nt:unstructured] WHERE ISCHILDNODE([nt:unstructured],'\/testNode')",
    "queryPlan": [
         "Access [nt:unstructured]",
         "  Project [nt:unstructured] <PROJECT_COLUMNS=[[nt:unstructured].[jcr:primaryType] AS [nt:unstructured.jcr:primaryType], [nt:unstructured].[jcr:mixinTypes] AS [nt:unstructured.jcr:mixinTypes], [nt:unstructured].[jcr:path] AS [nt:unstructured.jcr:path], [nt:unstructured].[jcr:name] AS [nt:unstructured.jcr:name], [nt:unstructured].[jcr:score] AS [nt:unstructured.jcr:score], [nt:unstructured].[mode:localName] AS [nt:unstructured.mode:localName], [nt:unstructured].[mode:depth] AS [nt:unstructured.mode:depth]], PROJECT_COLUMN_TYPES=[STRING, STRING, STRING, STRING, DOUBLE, STRING, LONG]>",
         "    Select [nt:unstructured] <SELECT_CRITERIA=ISCHILDNODE([nt:unstructured],'\/testNode')>",
         "      Select [nt:unstructured] <SELECT_CRITERIA=[nt:unstructured].[jcr:primaryType] = 'nt:unstructured'>",
         "        Source [nt:unstructured] <SOURCE_NAME=__ALLNODES__, SOURCE_COLUMNS=[jcr:frozenUuid(STRING), mode:sharedUuid(REFERENCE), mode:sessionScope(BOOLEAN), jcr:defaultValues(STRING), mode:projectedNodeKey(STRING), jcr:mixinTypes(STRING), jcr:frozenPrimaryType(STRING), jcr:defaultPrimaryType(STRING), jcr:statement(STRING), jcr:lastModifiedBy(STRING), jcr:mimeType(STRING), jcr:hasOrderableChildNodes(BOOLEAN), jcr:etag(STRING), jcr:encoding(STRING), jcr:root(REFERENCE), jcr:supertypes(STRING), jcr:successors(REFERENCE), jcr:primaryItemName(STRING), jcr:hold(STRING), jcr:workspace(STRING), jcr:description(STRING), jcr:primaryType(STRING), mode:externalNodeKey(STRING), mode:derivedFrom(STRING), mode:isHeldBySession(BOOLEAN), jcr:baseVersion(REFERENCE), jcr:lastModified(DATE), jcr:mergeFailed(REFERENCE), mode:derivedAt(DATE), jcr:requiredPrimaryTypes(STRING), jcr:multiple(BOOLEAN), mode:generated(BOOLEAN), jcr:activityTitle(STRING), jcr:lifecyclePolicy(REFERENCE), jcr:isMixin(BOOLEAN), jcr:availableQueryOperators(STRING), jcr:childVersionHistory(REFERENCE), jcr:content(REFERENCE), jcr:autoCreated(BOOLEAN), mode:alias(STRING), jcr:createdBy(STRING), jcr:isFullTextSearchable(BOOLEAN), jcr:uuid(STRING), jcr:onParentVersion(STRING), mode:expirationDate(DATE), jcr:lockIsDeep(BOOLEAN), jcr:copiedFrom(REFERENCE), jcr:isDeep(BOOLEAN), jcr:title(STRING), jcr:versionableUuid(STRING), jcr:versionHistory(REFERENCE), jcr:isAbstract(BOOLEAN), jcr:predecessors(REFERENCE), jcr:lockOwner(STRING), mode:sha1(STRING), jcr:repository(STRING), jcr:created(DATE), jcr:frozenMixinTypes(STRING), mode:lockedKey(STRING), jcr:text(STRING), jcr:host(STRING), jcr:configuration(REFERENCE), jcr:port(STRING), mode:workspace(STRING), jcr:nodeTypeName(STRING), jcr:data(BINARY), jcr:isQueryable(BOOLEAN), jcr:language(STRING), jcr:isQueryOrderable(BOOLEAN), jcr:mandatory(BOOLEAN), jcr:isCheckedOut(BOOLEAN), jcr:protected(BOOLEAN), jcr:sameNameSiblings(BOOLEAN), jcr:requiredType(STRING), jcr:protocol(STRING), mode:lockingSession(STRING), jcr:messageId(STRING), jcr:id(REFERENCE), mode:uri(STRING), jcr:valueConstraints(STRING), jcr:retentionPolicy(REFERENCE), jcr:activity(REFERENCE), jcr:currentLifecycleState(STRING), jcr:path(STRING), jcr:name(STRING), jcr:score(DOUBLE), mode:localName(STRING), mode:depth(LONG)], SOURCE_ALIAS=nt:unstructured>"
        ]
}

Note that the JSON response contains several fields, including the original query statement, the language, the abstract query model (or AQM, which is always equivalent to the JCR-SQL2 form of the query), and the query plan (as an array of strings).

Response Format (as "text/plain"):

Access [nt:unstructured]
  Project [nt:unstructured] <PROJECT_COLUMNS=[[nt:unstructured].[jcr:primaryType] AS [nt:unstructured.jcr:primaryType], [nt:unstructured].[jcr:mixinTypes] AS [nt:unstructured.jcr:mixinTypes], [nt:unstructured].[jcr:path] AS [nt:unstructured.jcr:path], [nt:unstructured].[jcr:name] AS [nt:unstructured.jcr:name], [nt:unstructured].[jcr:score] AS [nt:unstructured.jcr:score], [nt:unstructured].[mode:localName] AS [nt:unstructured.mode:localName], [nt:unstructured].[mode:depth] AS [nt:unstructured.mode:depth]], PROJECT_COLUMN_TYPES=[STRING, STRING, STRING, STRING, DOUBLE, STRING, LONG]>
    Select [nt:unstructured] <SELECT_CRITERIA=ISCHILDNODE([nt:unstructured],'/testNode')>
      Select [nt:unstructured] <SELECT_CRITERIA=[nt:unstructured].[jcr:primaryType] = 'nt:unstructured'>
        Source [nt:unstructured] <SOURCE_ALIAS=nt:unstructured, SOURCE_NAME=__ALLNODES__, SOURCE_COLUMNS=[jcr:frozenUuid(STRING), mode:sharedUuid(REFERENCE), mode:sessionScope(BOOLEAN), jcr:defaultValues(STRING), mode:projectedNodeKey(STRING), jcr:mixinTypes(STRING), jcr:frozenPrimaryType(STRING), jcr:defaultPrimaryType(STRING), jcr:statement(STRING), jcr:lastModifiedBy(STRING), jcr:mimeType(STRING), jcr:hasOrderableChildNodes(BOOLEAN), jcr:etag(STRING), jcr:encoding(STRING), jcr:root(REFERENCE), jcr:supertypes(STRING), jcr:successors(REFERENCE), jcr:primaryItemName(STRING), jcr:hold(STRING), jcr:workspace(STRING), jcr:description(STRING), jcr:primaryType(STRING), mode:externalNodeKey(STRING), mode:derivedFrom(STRING), mode:isHeldBySession(BOOLEAN), jcr:baseVersion(REFERENCE), jcr:lastModified(DATE), jcr:mergeFailed(REFERENCE), mode:derivedAt(DATE), jcr:requiredPrimaryTypes(STRING), jcr:multiple(BOOLEAN), mode:generated(BOOLEAN), jcr:activityTitle(STRING), jcr:lifecyclePolicy(REFERENCE), jcr:isMixin(BOOLEAN), jcr:availableQueryOperators(STRING), jcr:childVersionHistory(REFERENCE), jcr:content(REFERENCE), jcr:autoCreated(BOOLEAN), mode:alias(STRING), jcr:createdBy(STRING), jcr:isFullTextSearchable(BOOLEAN), jcr:uuid(STRING), jcr:onParentVersion(STRING), mode:expirationDate(DATE), jcr:lockIsDeep(BOOLEAN), jcr:copiedFrom(REFERENCE), jcr:isDeep(BOOLEAN), jcr:title(STRING), jcr:versionableUuid(STRING), jcr:versionHistory(REFERENCE), jcr:isAbstract(BOOLEAN), jcr:predecessors(REFERENCE), jcr:lockOwner(STRING), mode:sha1(STRING), jcr:repository(STRING), jcr:created(DATE), jcr:frozenMixinTypes(STRING), mode:lockedKey(STRING), jcr:text(STRING), jcr:host(STRING), jcr:configuration(REFERENCE), jcr:port(STRING), mode:workspace(STRING), jcr:nodeTypeName(STRING), jcr:data(BINARY), jcr:isQueryable(BOOLEAN), jcr:language(STRING), jcr:isQueryOrderable(BOOLEAN), jcr:mandatory(BOOLEAN), jcr:isCheckedOut(BOOLEAN), jcr:protected(BOOLEAN), jcr:sameNameSiblings(BOOLEAN), jcr:requiredType(STRING), jcr:protocol(STRING), mode:lockingSession(STRING), jcr:messageId(STRING), jcr:id(REFERENCE), mode:uri(STRING), jcr:valueConstraints(STRING), jcr:retentionPolicy(REFERENCE), jcr:activity(REFERENCE), jcr:currentLifecycleState(STRING), jcr:path(STRING), jcr:name(STRING), jcr:score(DOUBLE), mode:localName(STRING), mode:depth(LONG)]>

The text response only contains the string representation of the query plan.

22. Reordering nodes

Assuming you create a parent node POSTing the following request:

{
    "jcr:primaryType":"nt:unstructured",
    "children":{
        "child1":{
            "prop":"child1"
        },
        "child2":{
            "prop":"child2"
        },
        "child3":{
            "prop":"child3"
        }
    }
}

Then you can reorder its children by issuing a PUT request with the following format:

{
    "children":{
        "child3":{
        },
        "child2":{
        },
        "child1":{
        }
    }
}

23. Moving nodes

In order to move a node using the REST service, 2 steps are required:

  1. Retrieve the node which should be moved and store its ID (the id member of the JSON response)

  2. Edit the parent-to-be node (aka. the new parent) via a PUT request which contains the ID of the node:

    {
        "children":{
            "child1":{
            },
            "child2":{
            },
            "child3":{
            },
            "41e666ff-0997-4ee0-9eb8-b41319f9f403": {
            }
        }
    }
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 12:06:53 UTC, last content change 2014-03-26 08:40:06 UTC.